<template>
  <div class="header" v-if="isPC">
    <div class="header-logo">
      <img @click="goToUrl('/home')" src="@/assets/svg/OntaNetworkSVG.svg" alt="logo" />
    </div>
    <div class="header-bg header-center">
      <div class="item item1" @click="goToUrl('/home')">Home</div>
      <div class="item item2" @click="goToUrl('/map')">Explorer</div>
      <div class="item item3" @click="goToUrl('/services')">Services</div>
      <div class="item item4" @click="goToWebUrl('https://docs.onta.network/')">
        Docs
      </div>
      <div class="item item5" @click="goToUrl('/blogs')">Blogs</div>
      <a href="mailto:hi@upnetwork.one" class="item item6">Contact Us</a>
    </div>
    <div></div>
    <!-- <div class="header-bg header-right">Connect Wallet</div> -->
  </div>
  <div v-else class="p_phoneHeader" :style="{ background: isShow ? 'rgba(0, 0, 0, 1)' : '' }">
    <img
      class="p_logo"
      @click="goToUrl('/home')"
      src="@/assets/svg/OntaNetworkSVG.svg"
      alt="logo"
    />
    <img
      @click="isShow = true"
      v-if="!isShow"
      class="p_more"
      src="@/assets/svg/phone/more.svg"
      alt=""
    />
    <img v-else @click="isShow = false" class="p_more" src="@/assets/svg/phone/close.svg" alt="" />
    <div class="p_her_took" v-show="isShow" @touchmove.prevent>
      <div class="p_her_t" @click="goToUrl('/map')">Explorer</div>
      <div class="p_her_t" @click="goToUrl('/services')">Services</div>
      <div class="p_her_t" @click="goToWebUrl('https://up-network-1.gitbook.io/up-network')">
        Docs
      </div>
      <div class="p_her_t" @click="goToUrl('/blogs')">Blogs</div>
      <div class="p_her_t">Contact Us</div>
    </div>
  </div>
</template>

<script>
import { useConfig } from '@/stores/config.js'
export default {
  name: 'Header',
  data() {
    return {
      isShow: false
    }
  },
  computed: {
    isPC() {
      return useConfig().isPc
    }
  },
  beforeMount: function () {},
  mounted() {},
  methods: {
    goToUrl(url) {
      if (!this.isPC) {
        this.isShow = false
      }
      this.$router.push(url)
    },
    goToWebUrl(url) {
      window.open(url, '_blank')
    }
  }
}
</script>

<style lang="scss" scoped>
.header {
  position: fixed;
  top: 0px;
  padding: 57px 75px 0px;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 9999;
  backdrop-filter: blur(12px);

  &-logo {
    position: absolute;
    display: flex;
    align-items: center;
    img {
      // width: 172px;
      height: 45px;
    }
  }
  &-bg {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 30px;
    height: 60px;
    backdrop-filter: blur(48px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    line-height: 60px;
  }
  &-center {
    color: #fff;
    font-size: 20px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 20px;
    .item {
      // padding: 0 20px;
      cursor: pointer;
      color: #fff;
      box-sizing: border-box;
      text-align: center;
    }
    .item1 {
      width: 95px;
    }
    .item2 {
      width: 116px;
    }
    .item3 {
      width: 119px;
    }
    .item4 {
      width: 88px;
    }
    .item5 {
      width: 89px;
    }
    .item6 {
      width: 144px;
    }

    .item:hover {
      font-weight: bold;
    }
  }
  &-right {
    width: 180px;
    color: #fff;
    font-size: 20px;
    text-align: center;
    cursor: pointer;
  }
}
.p_phoneHeader {
  width: 100%;
  height: 95px;
  position: fixed;
  top: 0px;
  left: 0px;
  box-sizing: border-box;
  padding: 15px 25px 15px 25px;
  display: flex;
  justify-content: center;
  backdrop-filter: blur(12px);
  z-index: 999;
  .p_logo {
    width: 172px;
    height: 65px;
  }
  .p_more {
    position: absolute;
    top: 32px;
    right: 25px;
    height: 28px;
  }
  .p_her_took {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 100%;
    height: calc(100vh - 95px);
    background-color: #000;
    top: 95px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 49px;
    .p_her_t {
      font-family: DM Sans;
      font-weight: 400;
      font-size: 20px;
      line-height: 30px;
      letter-spacing: 0%;
      vertical-align: middle;
      color: #fff;
      margin-bottom: 40px;
    }
  }
}
</style>
